import { Prefab, SpriteFrame, Node } from "cc";
import Singleton from "../utils/Singleton";
import { IState, Player } from "../common";
import { MahjongManager } from "../scenes/MahjongManager";
import { Seat } from "../Seat";



export default class DataManager extends Singleton {

    myPlayerId = 1
    myDirction = 0
    mySeatId = 1
    lastWinerDirction = 0
    state: IState = {
        players: [{
            id: 1,
            username: "测试1",
            direction: 1,
            sorce: 0,
        },
        {
            id: 2,
            username: "测试2",
            direction: 2,
            sorce: 0,

        },
        {
            id: 3,
            username: "测试3",
            direction: 3,
            sorce: 0,

        },
        {
            id: 4,
            username: "测试4",
            direction: 4,
            sorce: 0,

        }],
        tables: [{
            id: 0,
            playerIds: [1, 2, 3, 4],


        },
        {
            id: 0,
            playerIds: []
        },
        {
            id: 0,
            playerIds: []
        }, {
            id: 0,
            playerIds: []
        }],

    }

    player: Player;


    mm: MahjongManager;
    // jm: JoyStickManager;
    // stage: Node;
    // actorMap: Map<number, ActorManger> = new Map();
    // bulletMap: Map<number, BulletManager> = new Map();

    prefabMap: Map<String, Prefab> = new Map();

    textureMap: Map<String, Array<SpriteFrame>> = new Map();

    static get Instance() {
        return super.GetInstance<DataManager>()
    }

}